package com.zhangtai.modules.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhangtai.modules.dto.ScoreTopicDto;
import com.zhangtai.modules.entity.score.ScoreProgramTopicEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2020-10-14 15:03:55
 */
@Mapper
public interface ScoreProgramTopicDao extends BaseMapper<ScoreProgramTopicEntity> {

    @Select("<script> SELECT\n" +
            "\ttst.* \n" +
            "FROM\n" +
            "\ttb_score_program_topic tspt\n" +
            "\tLEFT JOIN tb_score_topic tst ON tspt.topic_id = tst.id " +
            "<where> tspt.is_delete = 0 \n" +
            "\tAND tspt.program_id = #{programId} \n" +
            "</where> ORDER BY tspt.sort ASC" +
            "</script>")
    public List<ScoreTopicDto> getScoreTopic(@Param(value = "programId") Long programId);

}
